package com.xxx.video.channel.adapters;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.xxx.video.R;
import com.xxx.video.channel.config.ChannelFragmentItemClickType;
import com.xxx.video.commen.adapters.BaseRecycleViewAdapter;
import com.xxx.video.commen.adapters.BaseViewHolder;

import butterknife.BindView;
import butterknife.OnClick;

public class ChannelFragmentTopAdapter extends BaseRecycleViewAdapter<Object, ChannelFragmentTopAdapter.MyHolder> {

    public ChannelFragmentTopAdapter(@NonNull Context context) {
        super(context);
    }

    @Override
    public MyHolder onCreateDefaultViewHolder(View view, int viewType) {
        return new MyHolder(view);
    }

    @Override
    public int getItemLayout(int viewType) {
        return R.layout.item_channel_fragment_top;
    }

    @Override
    public int getItemCount() {
        return 1;
    }

    @Override
    public boolean isSetBaseItemViewClickListener() {
        return false;
    }

    class MyHolder extends BaseViewHolder {

        @BindView(R.id.tv_item_channel_fragment_top_search)
        TextView tvItemChannelFragmentTopSearch;
        @BindView(R.id.tv_item_channel_fragment_all_channel)
        TextView tvItemChannelFragmentAllChannel;

        public MyHolder(View itemView) {
            super(itemView);
        }

        @Override
        public void setData2View(int position) {

        }

        @OnClick({R.id.tv_item_channel_fragment_top_search, R.id.tv_item_channel_fragment_all_channel})
        public void onViewClicked(View view) {
            switch (view.getId()) {
                case R.id.tv_item_channel_fragment_top_search:
                    if (onItemClickListener != null) {
                        onItemClickListener.onItemClick(null, 0, ChannelFragmentItemClickType.CHANNEL_FRAGMENT_ITEM_CLICK_TYPE_START_SEARCH);
                    }
                    break;
                case R.id.tv_item_channel_fragment_all_channel:
                    if (onItemClickListener != null) {
                        onItemClickListener.onItemClick(null, 0, ChannelFragmentItemClickType.CHANNEL_FRAGMENT_ITEM_CLICK_TYPE_START_ALL_CHANNEL);
                    }
                    break;
                default:
                    break;
            }
        }
    }
}
